using UnityEngine;
using QFramework;

// 1.请在菜单 编辑器扩展/Namespace Settings 里设置命名空间
// 2.命名空间更改后，生成代码之后，需要把逻辑代码文件（非 Designer）的命名空间手动更改
namespace QFramework.Example
{
	public partial class SimpleCircle : ViewController
	{
		[SerializeField]
		float float_rabius = 1;
		void Start()
		{
			Circle.Show();
			// Code Here
			Circle.OnTriggerEnter2DEvent((collection) =>
			{
				if (collection.GetComponent<HurttBox>())
				{
					if (collection == null || collection.GetComponent<HurttBox>() == null || collection.GetComponent<HurttBox>().owner == null) return;

					if (collection.GetComponent<HurttBox>().owner.CompareTag("Enemy"))
						collection.GetComponent<HurttBox>().owner.GetComponent<IEnemy>().OnSetHp(-5f);
				}
			}).UnRegisterWhenGameObjectDestroyed(gameObject);
		}
		void Update()
		{

			float rang = Time.frameCount;
			Vector2 anglePos = new Vector2(Mathf.Cos(rang * Mathf.Deg2Rad), Mathf.Sin(rang * Mathf.Deg2Rad)) * float_rabius;
			transform.LocalPosition(anglePos.x, anglePos.y)
			.LocalEulerAnglesZ(Time.frameCount * 10);


		}

	}
}
